package com.holystone.splunk.app.enums;

/**
 * Copyright (c) 2017, HOLYSTONE Technologies, Inc.
 * All right reserved.
 *
 * @author huyan
 * @date 2017/11/3
 * @desc:
 */
public class EventEnums {

    /**
     * 事件状态枚举类
     */
    public enum EventStateEnum{

        STATE_OPEN(0, "处理中"),
        STATE_CLOSE(1, "已关闭");

        private Integer stateCode;
        private String stateInfo;

        EventStateEnum(Integer stateCode, String stateInfo) {
            this.stateCode = stateCode;
            this.stateInfo = stateInfo;
        }

        public Integer getStateCode() {
            return stateCode;
        }

        public String getStateInfo() {
            return stateInfo;
        }

        public static String getStateMsg(Integer stateCode) {
            if (stateCode == null) {
                return "";
            }
            for (EventStateEnum state : values()) {
                if (stateCode.intValue() == state.getStateCode()) {
                    return state.getStateInfo();
                }
            }
            return "";
        }
    }

    /**
     * 事件级别枚举类
     */
    public enum EventLevelEnum{

        LEVEL_ONE(1, "一级"),
        LEVEL_TWO(2, "二级"),
        LEVEL_THREE(3, "三级");

        private Integer levelCode;
        private String levelInfo;

        EventLevelEnum(Integer levelCode, String levelInfo) {
            this.levelCode = levelCode;
            this.levelInfo = levelInfo;
        }

        public Integer getLevelCode() {
            return levelCode;
        }

        public String getLevelInfo() {
            return levelInfo;
        }

        public static String getLevelMsg(Integer levelCode) {
            if (levelCode == null) {
                return "";
            }
            for (EventLevelEnum level : values()) {
                if (levelCode.intValue() == level.getLevelCode()) {
                    return level.getLevelInfo();
                }
            }
            return "";
        }
    }

    /**
     * 发送邮件枚举类
     */
    public enum EmailEnum {

        EMAIL_SEND(0, "不发送"),
        EMAIL_NO_SEND(1, "发送");

        private Integer stateCode; // 状态码
        private String stateInfo; // 展示值

        EmailEnum(Integer stateCode, String stateInfo) {
            this.stateCode = stateCode;
            this.stateInfo = stateInfo;
        }

        public Integer getStateCode() {
            return stateCode;
        }

        public String getStateInfo() {
            return stateInfo;
        }

        public static String getStateMsg(Integer stateCode) {
            if (stateCode == null) {
                return "";
            }
            for (EmailEnum email : values()) {
                if (stateCode.intValue() == email.getStateCode()) {
                    return email.getStateInfo();
                }
            }
            return "";
        }
    }
}
